clear all
set mem 9999999
set more off


cd "$dir\Final_Data"

use Final_sample.dta, clear


global treat islam_school christ_school stmusl  stcath ///
 christianchrist3 christianislam3  ///
 islamicchrist3 islamicislam3
 
****Figure 1
cd "$dir\Graphs"
quietly{
reghdfe GPA_y1 $treat  if firstyear>=2002 & satmat!=. & satverb!=. & qualitychris!=. & qualitymusl!=. , absorb(i.firstyear##i.Dept1 firstyear) vce(cluster advisorIDyear)
}
twoway (kdensity  math_sat if e(sample) & christ_school, lp(solid) lc(green)  yaxis(2)  ) (kdensity math_sat if e(sample) & islam_school, lp(solid) lc(navy) yaxis(2)) (kdensity math_sat if e(sample) & secular_school, lp(solid) lc(red)  yaxis(2)), graphregion(color(white)) legend(label(1 "Christ School") label( 2 "Islam School") label( 3 "Secular School")) xtit("Math SAT") ytitle("Density", axis(2))
graph export FigureA1.png, as(png) replace

bys Dept1 firstyear: egen sec_sd=sd( prop_sec)
bys Dept1 firstyear: egen christ_sd=sd( prop_christ)
bys Dept1 firstyear: egen islam_sd=sd( prop_islam)

kdensity sec_sd if e(sample)
graph export Figure2a.png, as(png) replace
kdensity christ_sd if e(sample)
graph export Figure2b.png, as(png) replace
kdensity islam_sd if e(sample)
graph export Figure2c.png, as(png) replace

drop sec_sd christ_sd islam_sd


								*************************************************************************************************************
								**Table 1 Summary Stats
								*************************************************************************************************************

quietly{
reghdfe GPA_y1 $treat satmat satverb sex*    if firstyear>=2002 & satmat!=. & satverb!=. & qualitychris!=. & qualitymusl!=., absorb(i.firstyear##i.Dept1  fake_advisor_id) vce(cluster advisorIDyear)
reghdfe GPA_y1 $treat satmat satverb sex*  advsex*  if e(sample), absorb(c.firstyear##i.Dept1 firstyear Rank1) vce(cluster advisorIDyear) 
}

gen tenure=(Rank1==20 | Rank1==7)
**Row 1 and 2

sum sex1 if e(sample)
scalar meanfemale=r(mean)
scalar sdfemale=r(sd)
scalar obs=r(N)
sum sex1 if e(sample) & secular_school
scalar meanfemale1=r(mean)
scalar sdfemale1=r(sd)
scalar obs1=r(N)
sum sex1 if e(sample) & christ_school
scalar meanfemale2=r(mean)
scalar sdfemale2=r(sd)
scalar obs2=r(N)
sum sex1 if e(sample) & islam_school
scalar meanfemale3=r(mean)
scalar sdfemale3=r(sd)
scalar obs3=r(N)


foreach var in math_sat legacy GPA_sumstat dropout_1st gradin4 gradin6 GPA_grad_sumstat advsex1 tenure group_size prop_sec prop_christ prop_islam{
sum `var' if e(sample)
scalar mean`var'=r(mean)
scalar sd`var'=r(sd)
sum `var' if e(sample) & secular_school
scalar mean`var'1=r(mean)
scalar sd`var'1=r(sd)
sum `var' if e(sample) & christ_school
scalar mean`var'2=r(mean)
scalar sd`var'2=r(sd)
sum `var' if e(sample) & islam_school
scalar mean`var'3=r(mean)
scalar sd`var'3=r(sd)
}
	
								
													
								
capture file close Table1
file open Table1 using "$dir\Tables\Table1.tex",write replace
file write 	Table1 /// 
 "\begin{tabular}{l*{5}{c}}" _n ///			
			"\toprule" _n ///			
			"&\multicolumn{1}{c}{(1)}&\multicolumn{1}{c}{(2)}&\multicolumn{1}{c}{(3)}&\multicolumn{1}{c}{(4)}\\" _n ///			
			"&\multicolumn{1}{c}{All}&\multicolumn{1}{c}{Secular}&\multicolumn{1}{c}{Christian}&\multicolumn{1}{c}{Islamic}\\"_n ///			
			"&\multicolumn{1}{c}{Schools}&\multicolumn{1}{c}{School}&\multicolumn{1}{c}{School}&\multicolumn{1}{c}{School}\\" _n ///			
			"\midrule" _n ///			
			"\multicolumn{1}{l}{\textbf{A. Student Level Covariates \ \ \ \ \ \ \ \ }} \\" _n ///			
			"Female   & " %9.3f (meanfemale) "&" %9.3f (meanfemale1) "& " %9.3f (meanfemale2) "&" %9.3f (meanfemale3) "\\"  _n ///			
			"&" "("%-9.3f (sdfemale) ")" "&" "("%-9.3f (sdfemale1) ")"   "&" "("%-9.3f (sdfemale2) ")"       "&" "("%-9.3f (sdfemale3) ")"     "  \\" _n ///			
			"Math SAT     &"   %9.3f (meanmath_sat) "&" %9.3f (meanmath_sat1) "& " %9.3f (meanmath_sat2) "&" %9.3f (meanmath_sat3) "\\"  _n ///			
			"&" "("%-9.3f (sdmath_sat) ")" "&" "("%-9.3f (sdmath_sat1) ")"   "&" "("%-9.3f (sdmath_sat2) ")"       "&" "("%-9.3f (sdmath_sat3) ")"     "  \\" _n ///	
			"Legacy Status &"  %9.3f (meanlegacy) "&" %9.3f (meanlegacy1) "& " %9.3f (meanlegacy2) "&" %9.3f (meanlegacy3) "\\"  _n ///			
			"&" "("%-9.3f (sdlegacy) ")" "&" "("%-9.3f (sdlegacy1) ")"   "&" "("%-9.3f (sdlegacy2) ")"       "&" "("%-9.3f (sdlegacy3) ")"     "  \\" _n ///	
			"\addlinespace" _n ///			
			"\midrule" _n ///			
			"\addlinespace" _n ///			
			"\multicolumn{1}{l}{\textbf{B. Student Level Outcomes \ \ \ \ \ \ \ \ }} \\" _n ///			
			"\addlinespace" _n ///			
			"First-Year GPA &" %9.3f (meanGPA_sumstat) "&" %9.3f (meanGPA_sumstat1) "& " %9.3f (meanGPA_sumstat2) "&" %9.3f (meanGPA_sumstat3) "\\"  _n ///			
			"&" "("%-9.3f (sdGPA_sumstat) ")" "&" "("%-9.3f (sdGPA_sumstat1) ")"   "&" "("%-9.3f (sdGPA_sumstat2) ")"       "&" "("%-9.3f (sdGPA_sumstat3) ")"     "  \\" _n ///			
			"Dropout &"    %9.3f (meandropout_1st) "&" %9.3f (meandropout_1st1) "& " %9.3f (meandropout_1st2) "&" %9.3f (meandropout_1st3) "\\"  _n ///			
			"&" "("%-9.3f (sddropout_1st) ")" "&" "("%-9.3f (sddropout_1st1) ")"   "&" "("%-9.3f (sddropout_1st2) ")"       "&" "("%-9.3f (sddropout_1st3) ")"     "  \\" _n ///		
			"Graduate in 4 years &" %9.3f (meangradin4) "&" %9.3f (meangradin41) "& " %9.3f (meangradin42) "&" %9.3f (meangradin43) "\\"  _n ///			
			"&" "("%-9.3f (sdgradin4) ")" "&" "("%-9.3f (sdgradin41) ")"   "&" "("%-9.3f (sdgradin42) ")"       "&" "("%-9.3f (sdgradin43) ")"     "  \\" _n ///			
			"Graduate in 6 Years" "&"  %9.3f (meangradin6) "&" %9.3f (meangradin61) "& " %9.3f (meangradin62) "&" %9.3f (meangradin63) "\\"  _n ///			
			"&" "("%-9.3f (sdgradin6) ")" "&" "("%-9.3f (sdgradin61) ")"   "&" "("%-9.3f (sdgradin62) ")"       "&" "("%-9.3f (sdgradin63) ")"     "  \\" _n ///	
			"Graduation GPA" "&"  %9.3f (meanGPA_grad_sumstat) "&" %9.3f (meanGPA_grad_sumstat1) "& " %9.3f (meanGPA_grad_sumstat2) "&" %9.3f (meanGPA_grad_sumstat3) "\\"  _n ///			
			"&" "("%-9.3f (sdGPA_grad_sumstat) ")" "&" "("%-9.3f (sdGPA_grad_sumstat1) ")"   "&" "("%-9.3f (sdGPA_grad_sumstat2) ")"       "&" "("%-9.3f (sdGPA_grad_sumstat3) ")"     "  \\" _n ///	
			"\addlinespace" _n ///			
			"\midrule" _n ///			
			"\addlinespace" _n ///			
			"\multicolumn{1}{l}{\textbf{C. Peer Group Level Characteristics \ \ \ \ \ \ \ \ }} \\" _n ///			
			"\addlinespace" _n ///			
			"Female Advisor" "&" %9.3f (meanadvsex1) "&" %9.3f (meanadvsex11) "& " %9.3f (meanadvsex12) "&" %9.3f (meanadvsex13) "\\"  _n ///			
			"&" "("%-9.3f (sdadvsex1) ")" "&" "("%-9.3f (sdadvsex11) ")"   "&" "("%-9.3f (sdadvsex12) ")"       "&" "("%-9.3f (sdadvsex13) ")"     "  \\" _n ///			
			"Tenured Advisor" "&"  %9.3f (meantenure) "&" %9.3f (meantenure1) "& " %9.3f (meantenure2) "&" %9.3f (meantenure3) "\\"  _n ///			
			"&" "("%-9.3f (sdtenure) ")" "&" "("%-9.3f (sdtenure1) ")"   "&" "("%-9.3f (sdtenure2) ")"       "&" "("%-9.3f (sdtenure3) ")"     "  \\" _n ///				
			"Peer Group Size"  "&"  %9.3f (meangroup_size) "&" %9.3f (meangroup_size1) "& " %9.3f (meangroup_size2) "&" %9.3f (meangroup_size3) "\\"  _n ///			
			"&" "("%-9.3f (sdgroup_size) ")" "&" "("%-9.3f (sdgroup_size1) ")"   "&" "("%-9.3f (sdgroup_size2) ")"       "&" "("%-9.3f (sdgroup_size3) ")"     "  \\" _n ///			
			"Proportion Secular School Peers" "&" %9.3f (meanprop_sec) "&" %9.3f (meanprop_sec1) "& " %9.3f (meanprop_sec2) "&" %9.3f (meanprop_sec3) "\\"  _n ///			
			"&" "("%-9.3f (sdprop_sec) ")" "&" "("%-9.3f (sdprop_sec1) ")"   "&" "("%-9.3f (sdprop_sec2) ")"       "&" "("%-9.3f (sdprop_sec3) ")"     "  \\" _n ///	
			"Proportion Christian School Peers" "&" %9.3f (meanprop_christ) "&" %9.3f (meanprop_christ1) "& " %9.3f (meanprop_christ2) "&" %9.3f (meanprop_christ3) "\\"  _n ///			
			"&" "("%-9.3f (sdprop_christ) ")" "&" "("%-9.3f (sdprop_christ1) ")"   "&" "("%-9.3f (sdprop_christ2) ")"       "&" "("%-9.3f (sdprop_christ3) ")"     "  \\" _n ///			
			"Proportion Islamic School Peers &"     %9.3f (meanprop_islam) "&" %9.3f (meanprop_islam1) "& " %9.3f (meanprop_islam2) "&" %9.3f (meanprop_islam3) "\\"  _n ///			
			"&" "("%-9.3f (sdprop_islam) ")" "&" "("%-9.3f (sdprop_islam1) ")"   "&" "("%-9.3f (sdprop_islam2) ")"       "&" "("%-9.3f (sdprop_islam3) ")"     "  \\" _n ///	
			"\addlinespace" _n ///			
			"\midrule" _n ///			
			"N"   "&"  %8.0gc (obs) "&" %8.0gc (obs1) "&" %8.0gc (obs2) "&" %8.0gc (obs3) "\\"  _n ///			
			"\toprule" _n ///			
		"\end{tabular}\\"								
file close Table1								
								
								
	
								

								*************************************************************************************************************
								**Table 3 GPA
								*************************************************************************************************************
cd "$dir\Tables"								
		
global treat islam_school christ_school stmusl  stcath ///
 christianchrist3 christianislam3  ///
 islamicchrist3 islamicislam3
 
qui{
reghdfe GPA_y1 $treat satmat satverb legacy sex*    if firstyear>=2002 & satmat!=. & satverb!=. & qualitychris!=. & qualitymusl!=., absorb(i.firstyear##i.Dept1  fake_advisor_id) vce(cluster advisorIDyear)
reghdfe GPA_y1 $treat satmat satverb legacy sex*  advsex*  if e(sample), absorb(c.firstyear##i.Dept1 firstyear Rank1) vce(cluster advisorIDyear) 
gen sampletag=1 if e(sample)	
}

*Regression A: Peer match on First Year GPA 
 
reghdfe GPA_y1 $treat satmat satverb sex* legacy advsex*  if sampletag==1, absorb(c.firstyear##i.Dept1 firstyear Rank1) vce(cluster advisorIDyear) 
eststo zab
** PEERS EFFECTS for STUDEnTS FROM SECULAR Schools*** (Secular match)
lincomest stcath //All Secular schools peers relative to all Christian schools peers
eststo row11
estimates restore zab
lincomest stmusl  //All Secular schools peers relative to all Islamic schools peers
eststo  row21
estimates restore zab
** PEERS EFFECTS for STUDEnTS FROM CHRISTIAN Schools*** (Christian match)
lincomest -stcath-christianchrist3  //All Christian schools peers relative to all Secular schools peers
eststo row31
estimates restore zab
lincomest  -stcath-christianchrist3+stmusl+christianislam3 //All Christian schools peers relative to all Islamic schools peers
eststo row41
estimates restore zab
** PEERS EFFECTS for STUDEnTS FROM ISLAMIC Schools*** (Islam match)
lincomest  -stmusl-islamicislam3 //All Islamic schools peers relative to all Secular schools peers7
eststo row51
estimates restore zab
lincomest  -stmusl-islamicislam3+stcath+islamicchrist3 //All Muslim school peers relative to all Christian schools peers
eststo row61
estimates restore zab



*Regression B: Peer match on First Year GPA 

reghdfe GPA_y1 $treat satmat satverb legacy sex*    if sampletag==1 , absorb(i.firstyear##i.Dept1  fake_advisor_id) vce(cluster advisorIDyear)
** PEERS EFFECTS for STUDEnTS FROM SECULAR Schools*** (Secular match)
eststo zab2
lincomest stcath //All Secular schools peers relative to all Christian schools peers
eststo row12
estimates restore zab2
lincomest stmusl  //All Secular schools peers relative to all Islamic schools peers
eststo  row22
estimates restore zab2
** PEERS EFFECTS for STUDEnTS FROM CHRISTIAN Schools*** (Christian match)
lincomest -stcath-christianchrist3  //All Christian schools peers relative to all Secular schools peers
eststo row32
estimates restore zab2
lincomest  -stcath-christianchrist3+stmusl+christianislam3 //All Christian schools peers relative to all Islamic schools peers
eststo row42
estimates restore zab2
** PEERS EFFECTS for STUDEnTS FROM ISLAMIC Schools*** (Islam match)
lincomest  -stmusl-islamicislam3 //All Islamic schools peers relative to all Secular schools peers7
eststo row52
estimates restore zab2
lincomest  -stmusl-islamicislam3+stcath+islamicchrist3 //All Muslim school peers relative to all Christian schools peers
eststo row62
estimates restore zab2		
		
		


*Regression C: Peer match on First Year GPA 
reghdfe GPA_y1 $treat satmat satverb legacy sex*   meanpeersex christmeanpeersex muslmeanpeersex  peerqual christ_peerqual musl_peerqual prop_french christ_french musl_french  prop_eng christ_eng musl_eng missing_lang meantuition  christ_tuit musl_tuit if firstyear>=2002 & satmat!=. & satverb!=. & qualitychris!=. & qualitymusl!=. ,  absorb(i.firstyear##i.Dept1 fake_advisor_id) vce(cluster advisorIDyear)
gen sampletag2=1 if e(sample)

eststo zab3
** PEERS EFFECTS for STUDEnTS FROM SECULAR Schools*** (Secular match)
lincomest stcath //All Secular schools peers relative to all Christian schools peers
eststo row13
estimates restore zab3
lincomest stmusl  //All Secular schools peers relative to all Islamic schools peers
eststo  row23
estimates restore zab3
** PEERS EFFECTS for STUDEnTS FROM CHRISTIAN Schools*** (Christian match)
lincomest -stcath-christianchrist3  //All Christian schools peers relative to all Secular schools peers
eststo row33
estimates restore zab3
lincomest  -stcath-christianchrist3+stmusl+christianislam3 //All Christian schools peers relative to all Islamic schools peers
eststo row43
estimates restore zab3
** PEERS EFFECTS for STUDEnTS FROM ISLAMIC Schools*** (Islam match)
lincomest  -stmusl-islamicislam3 //All Islamic schools peers relative to all Secular schools peers7
eststo row53
estimates restore zab3
lincomest  -stmusl-islamicislam3+stcath+islamicchrist3 //All Muslim school peers relative to all Christian schools peers
eststo row63
estimates restore zab3




reghdfe GPA_y1 $treat satmat satverb legacy sex*    if sampletag2==1 , absorb(i.firstyear##i.Dept1  fake_advisor_id) vce(cluster advisorIDyear)
** PEERS EFFECTS for STUDEnTS FROM SECULAR Schools*** (Secular match)
eststo zab2
lincomest stcath //All Secular schools peers relative to all Christian schools peers
eststo row14
estimates restore zab2
lincomest stmusl  //All Secular schools peers relative to all Islamic schools peers
eststo  row24
estimates restore zab2
** PEERS EFFECTS for STUDEnTS FROM CHRISTIAN Schools*** (Christian match)
lincomest -stcath-christianchrist3  //All Christian schools peers relative to all Secular schools peers
eststo row34
estimates restore zab2
lincomest  -stcath-christianchrist3+stmusl+christianislam3 //All Christian schools peers relative to all Islamic schools peers
eststo row44
estimates restore zab2
** PEERS EFFECTS for STUDEnTS FROM ISLAMIC Schools*** (Islam match)
lincomest  -stmusl-islamicislam3 //All Islamic schools peers relative to all Secular schools peers7
eststo row54
estimates restore zab2
lincomest  -stmusl-islamicislam3+stcath+islamicchrist3 //All Muslim school peers relative to all Christian schools peers
eststo row64
estimates restore zab2		
		
		













***Reg D
reghdfe GPA_grad $treat  satmat satverb legacy sex*    if firstyear>=2002 & satmat!=. & satverb!=. & qualitychris!=. & qualitymusl!=., absorb(i.firstyear##i.Dept1  fake_advisor_id) vce(cluster advisorIDyear)

eststo zab4
** PEERS EFFECTS for STUDEnTS FROM SECULAR Schools*** (Secular match)
lincomest stcath //All Secular schools peers relative to all Christian schools peers
eststo row15
estimates restore zab4
lincomest stmusl  //All Secular schools peers relative to all Islamic schools peers
eststo  row25
estimates restore zab4
** PEERS EFFECTS for STUDEnTS FROM CHRISTIAN Schools*** (Christian match)
lincomest -stcath-christianchrist3  //All Christian schools peers relative to all Secular schools peers
eststo row35
estimates restore zab4
lincomest  -stcath-christianchrist3+stmusl+christianislam3 //All Christian schools peers relative to all Islamic schools peers
eststo row45
estimates restore zab4
** PEERS EFFECTS for STUDEnTS FROM ISLAMIC Schools*** (Islam match)
lincomest  -stmusl-islamicislam3 //All Islamic schools peers relative to all Secular schools peers7
eststo row55
estimates restore zab4
lincomest  -stmusl-islamicislam3+stcath+islamicchrist3 //All Muslim school peers relative to all Christian schools peers
eststo row65
estimates restore zab4


esttab row1* using Table3.tex, label  nocon  b(%9.3f) se(%9.3f) starlevels(* 0.1 ** 0.05 *** 0.01) replace
foreach i in  2 3 4 5 6{
esttab row`i'* using Table3.tex, label  nocon  b(%9.3f) se(%9.3f) starlevels(* 0.1 ** 0.05 *** 0.01) append
}


estimates clear

								*************************************************************************************************************
								************** TABLE 4  Dropout and Graduation
								*************************************************************************************************************

							
*Regression A: Peer match on First Year GPA 
reghdfe dropout_1st $treat satmat satverb legacy sex*  if sampletag==1 , absorb(i.firstyear##i.Dept1  fake_advisor_id) vce(cluster advisorIDyear)
eststo zab
** PEERS EFFECTS for STUDEnTS FROM SECULAR Schools*** (Secular match)
lincomest stcath //All Secular schools peers relative to all Christian schools peers
eststo row11
estimates restore zab
lincomest stmusl  //All Secular schools peers relative to all Islamic schools peers
eststo  row21
estimates restore zab
** PEERS EFFECTS for STUDEnTS FROM CHRISTIAN Schools*** (Christian match)
lincomest -stcath-christianchrist3  //All Christian schools peers relative to all Secular schools peers
eststo row31
estimates restore zab
lincomest  -stcath-christianchrist3+stmusl+christianislam3 //All Christian schools peers relative to all Islamic schools peers
eststo row41
estimates restore zab
** PEERS EFFECTS for STUDEnTS FROM ISLAMIC Schools*** (Islam match)
lincomest  -stmusl-islamicislam3 //All Islamic schools peers relative to all Secular schools peers7
eststo row51
estimates restore zab
lincomest  -stmusl-islamicislam3+stcath+islamicchrist3 //All Muslim school peers relative to all Christian schools peers
eststo row61
estimates restore zab

reghdfe gradin4 $treat satmat satverb legacy sex*  if firstyear>=2002 & firstyear<=2012 & satmat!=. & satverb!=. & qualitychris!=. & qualitymusl!=. ,  absorb(i.firstyear##i.Dept1  fake_advisor_id) vce(cluster advisorIDyear)
eststo zab2
lincomest stcath //All Secular schools peers relative to all Christian schools peers
eststo row12
estimates restore zab2
lincomest stmusl  //All Secular schools peers relative to all Islamic schools peers
eststo  row22
estimates restore zab2
** PEERS EFFECTS for STUDEnTS FROM CHRISTIAN Schools*** (Christian match)
lincomest -stcath-christianchrist3  //All Christian schools peers relative to all Secular schools peers
eststo row32
estimates restore zab2
lincomest  -stcath-christianchrist3+stmusl+christianislam3 //All Christian schools peers relative to all Islamic schools peers
eststo row42
estimates restore zab2
** PEERS EFFECTS for STUDEnTS FROM ISLAMIC Schools*** (Islam match)
lincomest  -stmusl-islamicislam3 //All Islamic schools peers relative to all Secular schools peers7
eststo row52
estimates restore zab2
lincomest  -stmusl-islamicislam3+stcath+islamicchrist3 //All Muslim school peers relative to all Christian schools peers
eststo row62
estimates restore zab2


reghdfe gradin6 $treat satmat satverb legacy sex*     if firstyear>=2002 & firstyear<=2012 & satmat!=. & satverb!=. & qualitychris!=. & qualitymusl!=. ,  absorb(i.firstyear##i.Dept1  fake_advisor_id) vce(cluster advisorIDyear)

eststo zab3
** PEERS EFFECTS for STUDEnTS FROM SECULAR Schools*** (Secular match)
lincomest stcath //All Secular schools peers relative to all Christian schools peers
eststo row13
estimates restore zab3
lincomest stmusl  //All Secular schools peers relative to all Islamic schools peers
eststo  row23
estimates restore zab3
** PEERS EFFECTS for STUDEnTS FROM CHRISTIAN Schools*** (Christian match)
lincomest -stcath-christianchrist3  //All Christian schools peers relative to all Secular schools peers
eststo row33
estimates restore zab3
lincomest  -stcath-christianchrist3+stmusl+christianislam3 //All Christian schools peers relative to all Islamic schools peers
eststo row43
estimates restore zab3
** PEERS EFFECTS for STUDEnTS FROM ISLAMIC Schools*** (Islam match)
lincomest  -stmusl-islamicislam3 //All Islamic schools peers relative to all Secular schools peers7
eststo row53
estimates restore zab3
lincomest  -stmusl-islamicislam3+stcath+islamicchrist3 //All Muslim school peers relative to all Christian schools peers
eststo row63
estimates restore zab3



esttab row1* using Table4.tex, label  nocon  b(%9.3f) se(%9.3f) starlevels(* 0.1 ** 0.05 *** 0.01) replace
foreach i in  2 3 4 5 6{
esttab row`i'* using Table4.tex, label  nocon  b(%9.3f) se(%9.3f) starlevels(* 0.1 ** 0.05 *** 0.01) append
}


estimates clear




								*************************************************************************************************************
								************** TABLE  B3 Pooled
								*************************************************************************************************************







gen prop_other= prop_sec+prop_christ if islam_school==1
replace prop_other= prop_islam+prop_christ if secular_school==1
replace prop_other= prop_islam+prop_sec if christ_school==1
egen st_other=std(prop_other)

label variable st_other "Different relative to similar peers"

**** GPA

*Regression A: Peer match on First Year GPA 
reghdfe GPA_y1 st_other satmat satverb sex* legacy advsex*   if sampletag==1 , absorb(c.firstyear##i.Dept1 firstyear Rank1) vce(cluster advisorIDyear)
eststo maj1 


*Regression B: Peer match on First Year GPA 
reghdfe GPA_y1 st_other satmat satverb sex* legacy advsex*  if sampletag==1 , absorb(i.firstyear##i.Dept1  fake_advisor_id) vce(cluster advisorIDyear)
eststo maj2
*Regression C: Peer match on First Year GPA (

reghdfe GPA_y1 st_other satmat satverb sex* legacy  advsex* meanpeersex   peerqual  prop_french   prop_eng  meantuition  if sampletag==1 , absorb(i.firstyear##i.Dept1  fake_advisor_id) vce(cluster advisorIDyear)
eststo maj3 




esttab maj* using TableB3.tex, label  nocon keep(st_other) b(%9.3f) se(%9.3f) starlevels(* 0.1 ** 0.05 *** 0.01) replace
estimates clear





